#!/bin/bash

#获取必要的组件
yum groupinstall lxde-desktop --forcearch=armv7hl -y
yum install tigervnc-server --forcearch=armv7hl -y

#设置必要的文件
mkdir ~/.vnc
wget https://gitee.com/mediateeee/anlinux-resources/raw/master/Scripts/DesktopEnvironment/Yum/Fedora/LXDE/xstartup -P ~/.vnc/
wget https://gitee.com/mediateeee/anlinux-resources/raw/master/Scripts/DesktopEnvironment/Yum/Fedora/LXDE/vncserver-start -P /usr/local/bin/
wget https://gitee.com/mediateeee/anlinux-resources/raw/master/Scripts/DesktopEnvironment/Yum/Fedora/LXDE/vncserver-stop -P /usr/local/bin/

chmod +x ~/.vnc/xstartup
chmod +x /usr/local/bin/vncserver-start
chmod +x /usr/local/bin/vncserver-stop

echo " "
echo "您现在可以通过运行 vncserver-start 来启动 vncserver"
echo " "
echo "第一次启动时会要求你输入密码。"
echo " "
echo "VNC 服务器将在 127.0.0.1:5901 启动"
echo " "
echo "您可以使用您喜欢的 VNC 查看器连接到此地址"
echo " "
echo "连接到这个地址将打开一个带有 LXDE 桌面环境的窗口"
echo " "
echo " "
echo " "
echo "正在运行 vncserver-start"
echo " "
echo " "
echo " "
echo "要杀死 VNC Server，只需运行 vncserver-stop"
echo " "
echo " "
echo " "

echo "export DISPLAY=":1"" >> /etc/profile
source /etc/profile

vncserver-start
